package br.com.j7.jdesk.persistence.repository.impl;

import java.util.List;

import br.com.j7.jdesk.library.exception.RepositoryException;
import br.com.j7.jdesk.persistence.entity.Enterprises;
import br.com.j7.jdesk.persistence.entity.ServicesSituations;
import br.com.j7.jdesk.persistence.repository.ServiceSituationRepository;

/**
 * 
 * 
 * @author Edivando Alves
 *
 */
public class ServiceSituationRepositoryImpl  extends AbstractRepository<ServicesSituations> implements ServiceSituationRepository{



	/*
	 * (non-Javadoc)
	 * @see br.com.j7.jdesk.persistence.repository.impl.AbstractRepository#find(java.lang.Integer)
	 */
	@Override
	public ServicesSituations find(Integer id) throws RepositoryException {
		try {
			return getEntity(ServicesSituations.class, id);
		} catch (RepositoryException e) {
			throw new RepositoryException(e);
		}
	}
	
	/*
	 * (non-Javadoc)
	 * @see br.com.j7.jdesk.persistence.repository.ServiceSituationRepository#findByServiceSituationAndEnterprise(java.lang.String, br.com.j7.jdesk.persistence.entity.Enterprises)
	 */
	@Override
	public ServicesSituations findByServiceSituationAndEnterprise(String cdServiceSituation, Enterprises enterprise) throws RepositoryException {
		try {
			return getEntity(ServicesSituations.class, "serviceSituationByCdServiceSituation", cdServiceSituation, enterprise);
		} catch (RepositoryException e) {
			throw new RepositoryException(e);
		}
	}

	/*
	 * (non-Javadoc)
	 * @see br.com.j7.jdesk.persistence.repository.impl.AbstractRepository#list()
	 */
	@Override
	public List<ServicesSituations> list() throws RepositoryException {
		try {
			return listByNamedQuery(ServicesSituations.class,"serviceSituation");
		} catch (RepositoryException e) {
			throw new RepositoryException(e);
		}
	}
	
	/*
	 * (non-Javadoc)
	 * @see br.com.j7.jdesk.persistence.repository.ServiceSituationRepository#listByEnterprise(br.com.j7.jdesk.persistence.entity.Enterprises)
	 */
	@Override
	public List<ServicesSituations> listByEnterprise(Enterprises enterprise) throws RepositoryException {
		try {
			return listByNamedQuery(ServicesSituations.class, "serviceSituationByEnterprise", enterprise );
		} catch (RepositoryException e) {
			throw new RepositoryException(e);
		}
	}
	
}
